﻿<UserControl x:Class="Noc.Pomodoro.Controls.PomodoroCalendarControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             x:Name="root">

  <UserControl.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../Styles/ShinyRed.xaml" />
        <ResourceDictionary Source="../Styles/ApplicationStyles.xaml" />
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </UserControl.Resources>

  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition Width="*" />
      <ColumnDefinition Width="Auto" />
    </Grid.ColumnDefinitions>

    <Button Grid.Column="0" Width="21" Click="OnPreviousButtonClicked">
      <Button.Content>
        <Image Source="/Pomodoro;component/Resources/Action-Previous.png" Height="12" Width="12" />
      </Button.Content>
    </Button>
    <Button Grid.Column="2" Width="21" Click="OnNextButtonClicked">
      <Button.Content>
        <Image Source="/Pomodoro;component/Resources/Action-Next.png" Height="12" Width="12" />
      </Button.Content>
    </Button>
    <Grid Grid.Column="1">
      <ToggleButton x:Name="button" Grid.Column="1" Style="{StaticResource TogglePopupButton}">
        <ToggleButton.Content>
          <TextBlock Text="{Binding Path=SelectedDate, ElementName=root, StringFormat='{}{0:dddd, MMMM dd, yyyy}'}"
                   HorizontalAlignment="Center" />
        </ToggleButton.Content>
      </ToggleButton>
      <Popup x:Name="popupCalendar" IsOpen="{Binding IsChecked, ElementName=button}" StaysOpen="False">
        <Border Background="LightYellow">
          <Calendar SelectedDate="{Binding Path=SelectedDate, ElementName=root}" SelectedDatesChanged="OnCalendarSelectionChanged" />
        </Border>
        <Popup.RenderTransform>
          <ScaleTransform ScaleX="1.5" ScaleY="1.5" />
        </Popup.RenderTransform>
      </Popup>
    </Grid>
    <!--<DatePicker Grid.Column="1"
                SelectedDate="{Binding Path=SelectedDate, ElementName=root}"
                SelectedDateFormat="Long"
                HorizontalContentAlignment="Center"  />-->
  </Grid>

</UserControl>